use salvo::prelude::*;
use rbatis::crud::CRUD;
use chrono::prelude::*;
use crate::utils;
use serde_json::Value;
use rbatis::executor::{RBatisConnExecutor, RBatisTxExecutor, RbatisExecutor};
#[fn_handler]
pub async fn mysql_hello(_req: &mut Request, depot: &mut Depot, res: &mut Response) {
    let mut tx = utils::db::RB.acquire_begin().await.unwrap();
    let (v ,count) = tx.fetch::<serde_json::Value>("select * from sys_menu").await.unwrap();
    res.render_plain_text(&format!("{}", v.clone()));
    //rb.fetch**** and more method
    tx.commit().await.unwrap();
}
